package main

import (
	"io/ioutil"
	"fmt"
)

func main() {
	dirname := "/home/xiaonu"
	//fileInfos,err:=ioutil.ReadDir(dirname)
	//fmt.Println(len(fileInfos),err) //72个目录,只是一层
	//for _,fi:=range fileInfos{
	//	fmt.Println(fi.Name(),fi.IsDir())
	//	if fi.IsDir() {
	//		fileinfos2,_:=ioutil.ReadDir(dirname+"/"+fi.Name())
	//		fmt.Println(len(fileinfos2))
	//		for _,fi2:=range fileinfos2{
	//			fmt.Println(fi2.Name(),fi2.IsDir())
	//
	//		}
	//	}
	listFiles(dirname)
}
	func listFiles(dirname string) {
		fileinfo,_:=ioutil.ReadDir(dirname)
		for _,fi:= range fileinfo{
			filename:=dirname+"/"+fi.Name()
			fmt.Println(filename)
			if fi.IsDir(){
				listFiles(filename)
			}
	}
}
